PSA Object Model Diagrams

SObjectCloneMapper

global virtual with sharing class SObjectCloneMapper

the sobjectclonemapper class allows you to define the structure of sobjects that you want to clone. This object can be used by a cloning service to describe the data to be copied.

Properties

Name Type Description
SObjectRecordIdsToClone Set<Id> a set of ids to identify the records you want to clone from this sobjecttype. leave null to clone all ids found through relationships. If an empty list is passed, an attempt is not made to clone sObjects of this type.
SObjectTypeToClone Schema.SObjectType The SObjectType to clone.
SObjectFieldsToClone Set<SObjectCloneMapper.Field> The set of fields from SObjectTypeToClone to be copied from the cloned records. Fields on SObjectTypeToClone which are not in this set will have default values in the cloned records and will not have values copied from the source records.
SObjectRecordsToOverride Map<Id, SObject> A map of IDs to SObject records that are used to override cloned template records. To override the records, use the template record ID as the map key, and an SObject with values as the map value.

Methods

SObjectCloneMapper

global SObjectCloneMapper(Schema.SObjectType sObjectTypeToClone, Set<SObjectCloneMapper.Field> sObjectFieldsToClone)

A Default constructor with minimum required properties.

Input Parameters

Name Type Description
sObjectTypeToClone Schema.SObjectType The SObjectType of the object to be cloned.
sObjectFieldsToClone Set<SObjectCloneMapper.Field> The set of SObjectCloneMapper.Fields to be cloned.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

SObjectCloneMapper.NullFieldValue

global class NullFieldValue

used to represent an explicit null value. when the defaultvalue of a field is set to an instance of this class, the cloned records are created with a null in that field. The cloner should copy values for that field from the template when a default value is not provided.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

SObjectCloneMapper.Field

global class Field

each field provides information about a field on the sobject you want to clone. Add instances of this class to SObjectFieldsToClone on pse.SObjectCloneMapper.

Properties

Name Type Description
DefaultValue Object a value entered here is applied to the field of the cloned record. Leaving this value as null copies the field from the template. Other behavior may depend on configuration and settings. Setting DefaultValue to an instance of SObjectCloneMapper.NullFieldValue causes the cloned object to be created with a null value in this field.

Methods

Field

global Field(Schema.SObjectField field)

A default constructor with minimum required properties.

Input Parameters

Name Type Description
field Schema.SObjectField The Schema.SObjectField you want to clone.
© Copyright 2009–2021 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.